<{include file='../common/head.tpl'}>
<script language="javascript">
<{if $is_submit}>
var thisPage=false;
<{else}>
var thisPage=false;
<{/if}>
//$(window).bind('beforeunload',function(){
  //  if (thisPage) {
  //      return '请确认您所填写的信息，一旦提交将不可再次编辑';
  //  } 
//});
</script>
<div class="main w1060">
	<div class="biaoge">   
        <div class="fudong1"><input type="button" class="button" value="观看扣分指标" onclick="show_koufen();"/><br/><input type="button" class="button" value="观看全部指标" onclick="show_all();"/></div>
	<h2 class="wjtit"><{$question_info.question_name}></h2>
	<p class="wjbh"><label>问卷编号</label><{$question_info.identifier}></p>
	<table width="100%" border="0" cellspacing="0">
	  <!--可能和回答里有重复<tr>
		<td width="10%">网点名称:</td>
		<td width="18%"><span class="wjbh"><{$netquestion_info.network_name}></span></td>
		<td width="7%">网点编号:<br /></td>
		<td width="18%"><span class="wjbh"><{$network_info.network_num}></span></td>
		<{if $up_network_info}>
                <td width="9%">所属分行:</td>
		<td width="18%"><span class="wjbh"><{$up_network_info.network_name}></span></td>
		<td width="6%">分行编号:</td>
		<td width="14%"><span class="wjbh"><{$up_network_info.network_num}></span></td>
                <{/if}>
	  </tr>-->
          <{if $basic_list}>
          <{foreach $basic_list as $key => $val}>
	  <tr>
		<td colspan="2"><{$val.title}>:</td>
		<td colspan="6"><span class="wjbh"><{$answer_list[$val.subject_id].answer_desc}></span></td>
	  </tr>
          <{/foreach}>
          <{/if}>
	</table>
        <{foreach $classify_list['list'][1] as $parent_key => $parent_val}>
           <!--一级--> 
        <{if $parent_val}>
        <p class="wjbh pt10"><label><strong><{$classify_list['all'][$parent_val]}></strong></label></p>
        <{/if}>
        
        <!--是否有二级-->
        <{foreach $classify_list['list'][2] as $second_key => $second_val}>
            <{if isset($classify_list['parent'][$parent_val]) && ($second_val|in_array:$classify_list['parent'][$parent_val])}>
            <p class="wjbh pt10"><label><strong><{$classify_list['all'][$second_val]}></strong></label></p>
            <{/if}>
            <{foreach $classify_list['list'][3] as $classify_key => $classify_val}>
            <{if isset($classify_list['parent'][$second_val]) && ($classify_val|in_array:$classify_list['parent'][$second_val])}>
        <div class="group" id="<{$classify_val}>" style="display:none;">
	<p class="wjbh pt10"><label><strong><{$classify_list['all'][$classify_val]}></strong></label></p>
	<table width="100%" border="0" cellspacing="0">
	  <tr>
		<td width="40%"><strong>指标</strong></td>
		<td width="5%"><strong>标准分</strong></td>
                <td width="4%"><strong>得分</strong></td>
                <{if isset($classify_list[$classify_val])&&$classify_list[$classify_val].option}>
                <td width="5%"><strong>选项</strong></td>
                <td width="5%"><strong>选项值</strong></td>
                <{/if}>
		<td width="15%"><strong>情景描述</strong></td>
                <td width="4%"><strong>附件</strong></td>
                <{if $benchmark_list}><td width="10%"><strong>还分申请</strong></td><{/if}>
                <{if $netquestion_info.status==1}><td width="7%"><strong><{if $level==4}>申诉<{else}>操作<{/if}></strong></td><{/if}>
	  </tr>
          <{if $subject_list[$classify_val]}>
          <{foreach $subject_list[$classify_val] as $subject_key => $subject_val}>
            <!--只显示扣分的-->
	  <tr class="classify_<{$classify_val}>" data="<{if ($subject_val.standard_score|is_numeric)&&isset($answer_list[$subject_val.subject_id])&&($subject_val.standard_score!=$answer_list[$subject_val.subject_id].answer_score)}>show<{else}>hide<{/if}>">
		<td><p><{$subject_val.question_num}><{$subject_val.title}></p><p><{$subject_val.content}></p></td>
		<td><{if $question_info.show_score}>
                    <{if $subject_val.standard_score|is_number}><{$subject_val.standard_score|number_format:1}><{else}><{$subject_val.standard_score}><{/if}>
                    <{else}>是
                    <{/if}></td>
                <td><span class="wjbh">
                        <{if $answer_list[$subject_val.subject_id]}>
                            <{if $question_info.show_score}>
                                <{if $answer_list[$subject_val.subject_id].answer_score|is_number}>
                                <{$answer_list[$subject_val.subject_id].answer_score|number_format:1}>
                                <{else}>
                                <{$answer_list[$subject_val.subject_id].answer_score}>
                                <{/if}>
                            <{else}>
                                <{if $answer_list[$subject_val.subject_id].answer_score==$subject_val.standard_score}>是<{else}>否<{/if}>
                            <{/if}>
                        <{/if}>
                    </span></td>
                <{if isset($classify_list[$classify_val])&&$classify_list[$classify_val].option}><!--判断是否显示-->
                    <td>
                        <{if $option_list[$subject_val.subject_id]}>
                        <{foreach $option_list[$subject_val.subject_id] as $option_key => $option_val}>
                            <{$option_key}>:<{$option_val}><br/>
                        <{/foreach}>
                        <{/if}>
                    </td>
                    <td><{if $answer_list[$subject_val.subject_id]}><{$answer_list[$subject_val.subject_id].answer_option}><{/if}></td>
                <{/if}>
		<td><{if $answer_list[$subject_val.subject_id]}><{$answer_list[$subject_val.subject_id].answer_desc}><{/if}></td>
                <td>
                    <{if $attach_list[$subject_val.subject_id]}>
                    <a href="/benchmark/attach?nq_id=<{$nq_id}>&subject_id=<{$subject_val.subject_id}>" target="_blank" >附件</a>
                    <{/if}>
                </td>
                  <{if $benchmark_list}>
                 <td>
                   <{$benchmark_list[$subject_val.subject_id]['suggestion']}>
                 </td>
		 <{/if}>
                 <{if $netquestion_info.status==1}>
                <td id="go<{$subject_val.subject_id}>">
                    <{if $benchmark_list[$subject_val.subject_id]|count || $manage_list[$subject_val.subject_id]|count}><a href="javascript:void(0);" onclick="history(<{$netquestion_info.nq_id}>,<{$subject_val.subject_id}>);return false;">历史</a> <{/if}>
                    <!--如果是本级,如果已经申请过，不再显示-->
                    <{if ($netquestion_info.node_id==0&&$level==4)||($netquestion_info.node_id>=$level&&$level==4)}>
                    <!--没有扣分指标的不现实申诉-->
                    <{if ($subject_val.standard_score|is_numeric)&&isset($answer_list[$subject_val.subject_id])&&($subject_val.standard_score!=$answer_list[$subject_val.subject_id].answer_score)}>
                    <a href="#go<{$subject_val.subject_id}>"  name="go<{$subject_val.subject_id}>" onclick="shenqing(<{$netquestion_info.nq_id}>,<{$subject_val.subject_id}>);return false;">申诉</a>
                    <{/if}>
                    <{/if}>
                    <!--如果是上级,不是自己的问卷，并且有过还分申请-->
                    <{if ($netquestion_info.node_id==0||($netquestion_info.node_id>=$level))&&$netquestion_info.status==1&&$level!=4}>
                    <a href="javascript:void(0);" onclick="suggest(<{$netquestion_info.nq_id}>,<{$subject_val.subject_id}>);return false;">操作</a>
                    <{/if}>
                </td>
                <{/if}>
                
	  </tr>
            
          <{/foreach}>
          <{/if}>
	</table>
        </div>
        <{/if}>
        <{/foreach}>
        <{/foreach}>
        <{/foreach}>
	</table>
  </div>
</div>
<!--直接设置本问卷状态-->
<{if ($netquestion_info.node_id==0||$netquestion_info.node_id>=$level)&&$netquestion_info.status==1}>
<form name="form2" method="post" id="myForm1" action="/benchmark/SetAudit">
<div class="fudong">
    <{foreach $level_auth as $key => $val}>
    <{if $level==4}>
    <input type="hidden" name="audit" value="<{$val}>" /><br/>
    <{else}>
    <input type="radio" name='audit' value='<{$val}>' <{if $netquestion_info.audit==$val}>checked="checked"<{/if}>><{$audit[$val]}><br/>
    <{/if}>
    <{/foreach}>
    <input type="hidden" name="nq_id[]" value="<{$nq_id}>" />
    <input type="submit" class="button" value="提交问卷"/>
</div>
</form>
<{/if}>
<script type="text/javascript">
$(function(){
    //判断分组下是否有扣分项，如果没有将此分组隐藏,默认只显示扣分指标
    show_koufen();
    //提交问卷
    var options = {         
        beforeSubmit:  showRequest,  
        success:       showResponse,
        dataType:  'json'
    }
    $('#myForm1').ajaxForm(options); 
    
    <{if !$subject_id}>
    //提示
    layer.msg('请您选择观看扣分指标或观看全部指标', 2,-1);
    <{/if}>
    
    //刷新定位
    <{if $subject_id}>
    var pos = $('#go<{$subject_id}>').offset().top;
    $('html,body').animate({scrollTop:pos}, 500);
    <{/if}>
    
    
    
})
function showRequest(formData, jqForm, options) { 
    thisPage=true;
   <{if $level!=4}>
    var val=$('input:radio[name="audit"]:checked').val();
    if(val==null){
        alert("请先选择!");
        return false;
    }
    <{/if}>
    <{if !$is_submit}>
    if (confirm('提示：请确认您所填写的信息，一旦提交将不可再次编辑！')) {
        return true;
    } else {
        return false;
    }
    <{/if}>
    return true;
}
//提交成功关闭本页面，刷新来源页
function showResponse(responseText, statusText, xhr, $form)  { 
    alert(responseText.note);
    if (responseText.status==1) {
        window.thisPage = false;
        self.opener.location.reload();
        window.close();
    }
}

//显示所有指标
function show_all(){
    $('.group').each(function(i){
        var classify_id = $(this).attr('id');
        //每个分类下问题处理
        $('.classify_'+classify_id).each(function(i){
                $(this).show();
        })
        $(this).show();
    });
}
//只显示扣分指标
function show_koufen(){
    $('.group').hide();
    $('.group').each(function(i){
        var classify_show = false;
        var classify_id = $(this).attr('id');
        //每个分类下问题处理
        $('.classify_'+classify_id).each(function(i){
            var data = $(this).attr('data');
            if (data == 'hide') {
                $(this).hide();
            }
            //如果有show状态的，这个classify就显示,默认不显示
            if (data == 'show') {
                classify_show = true;
            }
        })
        if (classify_show) {
            $(this).show();
        }
    });
}
//问题对标的历史
function history(nq_id, subject_id){
    $.layer({
        type: 2, 
        title: '网点对标历史记录',
        border:[10, 0.3, '#000'],
        closeBtn:[0, true],
        shade: [0.5, '#000'],
        offset: ['100px', ''],
        area: ['800px', '450px'],
        iframe: {src: '/benchmark/history?nq_id='+nq_id+'&subject_id='+subject_id}
    });
}
//还分申请
function shenqing(nq_id,subject_id,qb_id){
    $.layer({
        type: 2,
        title: '对标内容',
        closeBtn: [0, true],
        shade: [0.5, '#000'],
        border:[10, 0.3, '#000'],
        offset: ['100px',''],
        area: ['550px', '450px'],
        iframe: {src: '/benchmark/duibiao?nq_id='+nq_id+'&subject_id='+subject_id}
    });   
}
//上级网点给出意见
function suggest(nq_id,subject_id){
    $.layer({
        type: 2,
        title: '审核意见',
        closeBtn: [0, true],
        shade: [0.5, '#000'],
        border:[10, 0.3, '#000'],
        offset: ['100px',''],
        area: ['500px', '400px'],
        iframe: {src: '/benchmark/suggest?nq_id='+nq_id+'&subject_id='+subject_id}
    });   
}
</script>
<h2 class="wjtit" style="text-align: center;">温馨提示：完成全部指标复议，或者对指标无异议后，请务必点右侧【提交问卷】，否则申诉无效！</h2>
<{include file="../common/footer.tpl"}>